{include file="layout/layout" /}
<meta http-equiv="Access-Control-Allow-Origin" content="cs.rongbaiwei.com">
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>商户管理 - 添加商户</h3>
                <h5 style="color:red;">商户默认密码123456</h5>
            </div>
        </div>
    </div>
    <form action="{:url('shop/submit_shop')}" method='post' id="roleform" enctype="multipart/form-data">
        <input type="hidden" name="agent_id" value="{$agent_manage}">
        <input type="hidden" name='longitude' id='jd'>
        <input type="hidden" name='latitude' id='wd'>
        {:token()}
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>商户账号</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" datatype="*" ajaxurl="{:url('shop/ajaxUsername')}" nullmsg="请填写商户账号，此账号用于登录" name="sp_username" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>店铺名称</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" datatype="*" nullmsg="请填写店铺名称方便用户搜索" name="name" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>店铺负责人手机号</label>
                </dt>
                <dd class="opt">
                    <!-- <input class="input-txt" datatype="/(13[0-9])\d{8}|(15[0-9])\d{8}|(17[0,3,6,7,8])\d{8}|(14[5,7])\d{8}|(18[0-9])\d{8}/" name="mobile" nullmsg="请填写负责人手机号" errormsg="手机格式不正确" type="text" maxlength='11'> -->
                    <input class="input-txt" name="mobile" type="text" maxlength='11' id='mobile'>
                    <span class="Validform_checktip Validform_wrong" id='m_error' style='display:none'>手机格式不正确</span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>店铺负责人姓名</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" datatype="*" name="true_name" nullmsg="负责人姓名必须填写" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label class="code_url">店铺LOGO</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" datatype="*" nullmsg="店铺logo必须上传" name="logo" type="file">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>营业执照注册名称</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" name="company" datatype="*" nullmsg="注册名称必填，客服会进行核实" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>营业执照注册法人</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" name="legal_person" datatype="*" nullmsg="法人必填，客服会进行核实" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>营业执照编号</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" name="bus_license" datatype="*" nullmsg="营业执照编号必填，客服会进行核实" type="text">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label class="code_url">营业执照</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" datatype="*" nullmsg="营业执照必须上传" name="image" type="file">
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>商户电话</label>
                </dt>
                <dd class="opt">
                    <!-- <input class="input-txt" name="phone" datatype="/^(0?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/" nullmsg="商户电话必填" type="text"> -->
                    <input class="input-txt" name="phone" type="text" id='phone'>
                    <span class="Validform_checktip Validform_wrong" id='p_error' style='display:none'>电话格式不正确</span>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>商户所属分类</label>
                </dt>
                <dd class="opt">
                    <select name="sp_tyid" datatype="*"nullmsg="请选择商户属性"id="shopCategory" >
                        <option value="">—— 请选择 ——</option>
                        {foreach $cates as $k=>$v}
                        <option value="{$v.ty_id}">{$v.ty_name}</option>
                        {/foreach}
                    </select>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>所属区域</label>
                </dt>
                <dd class="opt">
                    <select id="province" datatype="*" nullmsg="请选择所属区域"  name="district" >
                        <option value="">选择区域</option>
                        {foreach $area as $k=>$v}
                        <option value="{$v['id']}">{$v['merger_name']}</option>
                        {/foreach}
                    </select>
                </dd>

            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>商户地址</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" id='address' name="address" datatype="*" nullmsg="商户地址不能为空" type="text">
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label>提点（%oo）</label>
                </dt>
                <dd class="opt">
                    <input class="input-txt" name="sp_ratio" datatype="n1-3" errormsg="提点为万分比，只能是整数最多为3位" type="text">
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label>门店性质</label>
                </dt>
                <dd class="opt">
                    <input value="1" name="identity" checked  type="radio">
                    <label >个人</label> &nbsp;&nbsp;
                    <input value="0" name="identity"  type="radio">
                    <label >企业</label>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>状态</label>
                </dt>
                <dd class="opt">
                    <input value="1" name="status"  type="radio">
                    <label for="gender">正常</label> &nbsp;&nbsp;
                    <input value="2" name="status" checked type="radio">
                    <label for="gender">禁用</label>
                </dd>
            </dl>

            <!--<dl class="row">-->
                <!--<dt class="tit">-->
                    <!--<label>营业时间</label>-->
                <!--</dt>-->
                <!--<dd class="opt">-->
                    <!--<input type="time" name="data[sp_start_time]"> ~ <input type="time" name="data[sp_end_time]">-->
                <!--</dd>-->
            <!--</dl>-->
            <div class="bot"><button id="button" style="width:96px;height:35px;background: #4FC0E8;border-radius:5px;line-height:35px;text-align: center;color:#fff;border: 0;font-size: 15px;">确认提交</button></div>
        </div>
    </form>
</div>
<script>
    $(document).ready(function() {
        $('#roleform').Validform({
            tiptype: 3,
            beforeSubmit: function (data) {
                var check = 1;
                var mobile = $('#mobile').val();
                var res1 = /(13[0-9])\d{8}|(15[0-9])\d{8}|(17[0,3,6,7,8])\d{8}|(14[5,7])\d{8}|(18[0-9])\d{8}/;
                var prov = $('#province').find("option:selected").val();
                if(mobile && !res1.test(mobile)){
                    $('#m_error').show();
                    check++;
                }else{
                    $('#m_error').hide();
                }
                var phone = $('#phone').val();
                var res2 = /^(0?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8})|(400|800)([0-9\\-]{7,10})|(([0-9]{4}|[0-9]{3})(-| )?)?([0-9]{7,8})((-| |转)*([0-9]{1,4}))?$/;
                if(phone && !res2.test(phone)){
                    $('#p_error').show();
                    check++;
                }else{
                    $('#p_error').hide();
                }
                // 是否选择区域
                if($prov == 0){
                    $('#e_error').show();
                    check++;
                }else{
                    $('#e_error').hide();
                }

                if(check > 1){
                    return false;
                }else{
                    return true;
                }

            }
        });
    })
</script>

</body>
</html>